package com.mybills.proj;

import com.google.gdata.util.AuthenticationException;
import com.mybills.proj.pf.googlecal;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.View;
import android.widget.EditText;

public class event extends Activity{
	@SuppressWarnings("static-access")
	@Override
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.createdevent);
        MyBllsActivity mba = new MyBllsActivity();
        details_list  dl =  new details_list();
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
        Bundle bundle=getIntent().getExtras();
        mba.setEmail(bundle.getString("_email").toString());
        mba.setPwd(bundle.getString("_pwd").toString());
        dl.setBill_id(bundle.getString("Billid").toString());
        dl.setBill_place(bundle.getString("BILL_Place").toString());
        dl.setBill_amount(bundle.getString("BILL_Amount").toString());
        dl.setStart_time(bundle.getString("starttime").toString());
        dl.setEnd_time(bundle.getString("endtime").toString());
        dl.setDate(bundle.getString("date").toString());
        System.out.println(dl.getDate()+"------"+dl.getStart_time());
        pf p = new pf();
        pf.googlecal add = p.new googlecal();
        try {
			add.createEvent(mba, dl);
		} /*catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.print(e+"not added");
		}*/
		catch (AuthenticationException e) {
			// TODO Auto-generated catch block
			System.out.print(e+"not added");
			super.onCreate(savedInstanceState);
	        setContentView(R.layout.notvalid);
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
	public void menu(View v){
    	Intent it = new Intent();
    	Bundle bundle=getIntent().getExtras();
    	it.putExtra("EMAIL",bundle.getString("_email").toString());
    	it.putExtra("PWD",bundle.getString("_pwd").toString());
    	it.setClass(this, Login.class);
    	startActivity(it);
    }
	public void home(View v){
    	Intent it = new Intent();
    	it.setClass(this, MyBllsActivity.class);
    	startActivity(it);
    }
	public void to_categories1(View v){
    	Intent it = new Intent();
    	EditText et1 = (EditText)findViewById(R.id.email1);
        EditText et2 = (EditText)findViewById(R.id.password1);
        it.putExtra("EMAIL",et1.getText().toString() );
    	it.putExtra("PWD",et2.getText().toString() );
    	it.setClass(this, Login.class);
    	startActivity(it);
    }
}
